import { formatTime } from '@/utils'
import i18n from '@/locales/index'
const { t } = i18n.global

export const listColumns = [
  { title18: 'hangManage.scheduledNo', dataIndex: 'scheduleBillNo', key: 'scheduleBillNo', align: 'center', width: 150, fixed: 'left', resizable: true },
  { title18: 'common.state', dataIndex: 'status', key: 'status', align: 'center', width: 100, resizable: true, sorter: true },
  { title18: 'other.numberOfAttachedDisks', dataIndex: 'inputQty', key: 'inputQty', align: 'center', width: 100, resizable: true },
  // { title: '裁片仓库存', dataIndex: 'inputQty', key: 'inputQty', align: 'center', width: 100, resizable: true },
  // { title: '裁片仓状态', dataIndex: 'cutBinStatus', key: 'cutBinStatus', align: 'center', width: 155, resizable: true },
  { title18: 'hangManage.taskNumber', dataIndex: 'produceQty', key: 'produceQty', align: 'right', width: 120, resizable: true },
  { title18: 'hangManage.completeNumber', dataIndex: 'finishedQty', key: 'finishedQty', align: 'right', width: 120, resizable: true },
  { title18: 'hangManage.completeIngNumber', dataIndex: 'unfinishedQty', key: 'unfinishedQty', align: 'right', width: 120, resizable: true },
  { title18: 'common.unit', dataIndex: 'unit', key: 'unit', align: 'center', width: 120, resizable: true },
  { title18: 'hangManage.makeNo', dataIndex: 'moNo', key: 'moNo', align: 'center', width: 160, resizable: true },
  { title18: 'basicData.styleNo', dataIndex: 'styleNo', key: 'styleNo', align: 'center', width: 120, resizable: true },
  { title18: 'basicData.styleNa', dataIndex: 'styleName', key: 'styleName', align: 'center', width: 120, visibility: false, resizable: true },
  { title18: 'hangManage.workOrderNo', dataIndex: 'workOrderNo', key: 'workOrderNo', align: 'center', width: 120, visibility: false, resizable: true },
  { title18: 'hangManage.proLocation', dataIndex: 'productPart', key: 'productPart', align: 'center', width: 120, visibility: false, resizable: true },
  { title18: 'basicData.orderNo', dataIndex: 'orderNo', key: 'orderNo', align: 'center', width: 120, visibility: false, resizable: true },
  { title18: 'basicData.color', dataIndex: 'color', key: 'color', align: 'center', width: 120, resizable: true },
  { title18: 'basicData.size', dataIndex: 'size', key: 'size', align: 'center', width: 120, resizable: true },
  { title18: 'hangManage.poNo', dataIndex: 'poNo', key: 'poNo', align: 'center', width: 120, resizable: true },
  { title18: 'hangManage.bedNo', dataIndex: 'cutterNo', key: 'cutterNo', align: 'center', width: 100, resizable: true },
  { title18: 'hangManage.cut', dataIndex: 'tailorBill', key: 'tailorBill', align: 'center', width: 100, resizable: true },
  { title18: 'hangManage.road', dataIndex: 'roadMapName', key: 'roadMapName', align: 'center', width: 150, resizable: true },
  { title18: 'menu.basic:section', dataIndex: 'sectionName', key: 'sectionName', align: 'center', width: 120, resizable: true },
  { title: '下线入仓', dataIndex: 'sortingFinishedProductIn', key: 'sortingFinishedProductIn', align: 'center', width: 100, resizable: true, showCabin: true },
  { title: '入仓类型', dataIndex: 'sortingFinishedProductInCode', key: 'sortingFinishedProductInCode', align: 'center', width: 150, resizable: true, showCabin: true },
  {
    title18: t('common.createTime'), dataIndex: 'createTime', key: 'createTime', align: 'center', width: 120, timeType: 'day', resizable: true,
    customRender: ({ text }) => {
      return formatTime(text, 'YYYY-MM-DD')
    }
  },
  {
    title18: t('other.PF'), dataIndex: 'planFinishTime', key: 'planFinishTime', align: 'center', width: 120, timeType: 'day', visibility: false, resizable: true,
    customRender: ({ text }) => {
      return formatTime(text, 'YYYY-MM-DD')
    }
  },
  { title18: 'common.founder', dataIndex: 'createBy', key: 'createBy', align: 'center', width: 80 },
  { title18: 'hangManage.allowOverPro', dataIndex: 'overProduceQty', key: 'overProduceQty', align: 'center', width: 120, fixed: 'right', resizable: true },
  { title18: 'common.operate', dataIndex: 'operate', key: 'operate', align: 'center', width: 180, fixed: 'right' }
]
export const wipListSearchParams = [
  { title: t('hangManage.scheduledNo'), key: 'scheduleBillNo', disabled: true, show: true, type: 'input', maxLength: 29 },
  { title: t('common.state'), key: 'status', show: true, type: 'select' },
  { title: t('hangManage.makeNo'), key: 'moNo', show: false, type: 'input', maxLength: 29 },
  { title: t('basicData.styleNo'), key: 'styleNo', type: 'input', maxLength: 29 },
  { title: t('basicData.styleNa'), key: 'styleName', type: 'input', maxLength: 29 },
  { title: t('hangManage.workOrderNo'), key: 'workOrderNo', type: 'input', maxLength: 29 },
  { title: t('hangManage.proLocation'), key: 'productPart', type: 'select' },
  { title: t('basicData.orderNo'), key: 'orderNo', type: 'input', maxLength: 29 },
  { title: t('basicData.color'), key: 'color', type: 'input', maxLength: 9 },
  { title: t('basicData.size'), key: 'size', type: 'input', maxLength: 9 },
  { title: t('hangManage.poNo'), key: 'poNo', type: 'input', maxLength: 9 },
  { title: t('hangManage.bedNo'), key: 'cutterNo', type: 'input', maxLength: 9 },
  { title: t('hangManage.cut'), key: 'tailorBill', type: 'input', maxLength: 9 },
  { title: t('hangManage.road'), key: 'roadMapName', type: 'input', maxLength: 29 },
  { title: t('menu.basic:section'), key: 'sectionName', type: 'select' },
  // { title: t('hangManage.startStation'), key: 'stationNoList', type: 'cascader' },
  { title: t('common.createTime'), key: 'Time', type: 'time' },
  { title: t('other.PF'), key: 'RealFinishTime', type: 'time' }

]
export const wipRule = {
  moId: [
    { required: true, message: t('other.selectMakeNo') }
  ],
  sectionId: [
    { required: true, message: t('basicData.pleaseSelectSection') }
  ],
  roadMapId: [
    { required: true, message: t('other.selectRoadVer') }
  ],
  stationIds: [
    { required: true, message: t('other.selectHangerSite') }
  ]
}

export const serialNumberInfo = {
  title: t('common.sequence'), dataIndex: 'index', key: 'index', align: 'center', width: 60,
  customRender: ({ index }) => {
    return index + 1
  }
}

export const _makeColumns = [ 
  { title: t('hangManage.poNo'), dataIndex: 'poNo', key: 'poNo', align: 'center', width: 200 }, 
  { title: t('basicData.color'), dataIndex: 'color', key: 'color', align: 'center', width: 100 },
  { title: t('basicData.size'), dataIndex: 'size', key: 'size', align: 'center', width: 100 },
  { title: t('other.makeNo'), dataIndex: 'quantity', key: 'quantity', align: 'right', width: 100 },
  { title: t('hangManage.allocatedNumber'), dataIndex: 'assignedQty', key: 'assignedQty', align: 'right', width: 100 },
  { title: t('hangManage.unallocatedNumber'), dataIndex: 'unassignedQty', key: 'unassignedQty', align: 'right', width: 100 },
  { title: t('hangManage.taskNumber'), dataIndex: 'produceQty', key: 'produceQty', align: 'center', width: 140 },
  { title: t('common.unit'), dataIndex: 'unit', key: 'unit', align: 'center', width: 140 },
  { title: t('hangManage.allowOverProNumber'), dataIndex: 'overProduceQty', key: 'overProduceQty', align: 'center', width: 140 },
  { title: t('other.PF'), dataIndex: 'planFinishTime', key: 'planFinishTime', align: 'center', width: 140 },
]

export const requireMakeColumns = [
  { label: t('hangManage.taskNumber'), value: 'produceQty' },
  { label: t('common.unit'), value: 'unit' }
]

export const roadmapColumns = [
  {
    title: t('common.sequence'), dataIndex: 'index', key: 'index', align: 'center', width: 60,
    customRender: ({ index }) => {
      return index + 1
    }
  },
  { title: t('basicData.processSequence'), dataIndex: 'sort', key: 'sort', align: 'center', width: 120 },
  { title: t('basicData.processNo'), dataIndex: 'processNo', key: 'processNo', align: 'center' },
  { title: t('basicData.processCodes'), dataIndex: 'processCode', key: 'processCode', align: 'center' },
  { title: t('basicData.processNames'), dataIndex: 'name', key: 'name', align: 'center' },
  {
    title: t('hangManage.stationNumber'), dataIndex: 'listLength', key: 'listLength', align: 'right',
    customRender: ({ record }) => {
      return record.moProcRoadmapProcStationList && record.moProcRoadmapProcStationList.length
    }
  },
  {
    title: t('hangManage.stationList'), dataIndex: 'stationList', key: 'stationList', align: 'center',
    customRender: ({ record }) => {
      return record.moProcRoadmapProcStationList && record.moProcRoadmapProcStationList.map(i => i.stationNo).join()
    }
  }
]